package com.cxhc.cockpit;


import com.cxhc.common.annotation.Anonymous;
import com.cxhc.common.core.domain.R;
import com.cxhc.system.service.ISysUserService;
import com.cxhc.system.service.cockpit.ISysEntService;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * 企业
 */
@RestController()
@RequestMapping("/cockpit/sysEnterprise")
@CrossOrigin(origins = "*", maxAge = 3600)
public class ApiSysEnterprise {

    @Resource
    private ISysEntService sysEntService;

    /**
     * 查询企业数量
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryEntCount")
    public R<Integer> queryEnt(String date) {
        return R.ok(sysEntService.selectEntByDate(date));
    }

    /**
     * 查询企业分类占比
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryEntType")
    public R<Map<String,String>> queryEntByTyp(String date) {
        return R.ok(sysEntService.selectEntByType(date));
    }


    /**
     * 统计楼宇企业和人员数量
     */
    @Anonymous
    @SneakyThrows
    @RequestMapping("/queryByFloor")
    public R<Map<String,Map<String,Object>>> queryByFloor(String date) {
        return R.ok(sysEntService.queryByFloor(date));
    }

}
